'use strict';

var fs=require('fs');

module.exports={
    endsWith: endsWith,
    parseVersion: parseVersion,
    isLintFixed : isLintFixed
}

function endsWith(str,suffix){
    return str.indexOf('/',str.length-suffix.length)!==-1;
}

function parseVersion(){
    //匹配版本号
    var versionRegex=/^version\s*=\s*[',"]([^',"]*)[',"]/gm;
    var buildGradle=fs.readFileSync('build.gradle', 'utf8');
    return versionRegex.exec(buildGradle)[1];
}

function isLintFixed(){
    return file.eslint!==null&&file.eslint.fixed;
}